repo: Rename ostree_repo_check to ostree_repo_open
authorJasper St. Pierre <jstpierre@mecheye.net>
Thu, 5 Sep 2013 17:41:46 +0000 (13:41 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Thu, 5 Sep 2013 18:07:03 +0000 (14:07 -0400)
As it more clearly describes what the function does: load the
repo from disk and initialize it.

At the same time, add a cancellable parameter.

https://bugzilla.gnome.org/show_bug.cgi?id=707582

src/libostree/ostree-repo.c
src/libostree/ostree-repo.h
src/ostree/ot-admin-builtin-upgrade.c
src/ostree/ot-admin-functions.c
src/ostree/ot-builtin-pull-local.c
src/ostree/ot-main.c

index 3ee48c8f91a43735705222af1fd1c8b20c93c02c..814babeb72cec750ac9beeec6cf7650f2b820d08 100644 (file)
@@ -54,7 +54,7 @@
  *
  * Creating an #OstreeRepo does not invoke any file I/O, and thus needs
  * to be initialized, either from an existing contents or with a new
- * repository. If you have an existing repo, use ostree_repo_check()
+ * repository. If you have an existing repo, use ostree_repo_open()
  * to load it from disk and check its validity. To initialize a new
  * repository in the given filepath, use ostree_repo_create() instead.
  *
@@ -434,7 +434,7 @@ ostree_repo_create (OstreeRepo     *self,
   if (!g_file_make_directory (grandchild, cancellable, error))
     goto out;
 
-  if (!ostree_repo_check (self, error))
+  if (!ostree_repo_open (self, cancellable, error))
     goto out;
 
   ret = TRUE;
@@ -446,7 +446,9 @@ ostree_repo_create (OstreeRepo     *self,
 }
 
 gboolean
-ostree_repo_check (OstreeRepo *self, GError **error)
+ostree_repo_open (OstreeRepo    *self,
+                  GCancellable  *cancellable,
+                  GError       **error)
 {
   gboolean ret = FALSE;
   gboolean is_archive;
@@ -467,7 +469,7 @@ ostree_repo_check (OstreeRepo *self, GError **error)
       goto out;
     }
 
-  if (!gs_file_ensure_directory (self->pending_dir, FALSE, NULL, error))
+  if (!gs_file_ensure_directory (self->pending_dir, FALSE, cancellable, error))
     goto out;
   
   self->config = g_key_file_new ();
@@ -514,7 +516,7 @@ ostree_repo_check (OstreeRepo *self, GError **error)
 
       self->parent_repo = ostree_repo_new (parent_repo_f);
 
-      if (!ostree_repo_check (self->parent_repo, error))
+      if (!ostree_repo_open (self->parent_repo, cancellable, error))
         {
           g_prefix_error (error, "While checking parent repository '%s': ",
                           gs_file_get_path_cached (parent_repo_f));
index 1aea7842dfadcbeb70999e79029c5bb06da9c067..94e11e929503a62c9ed25bb8c2d4b267b8723340 100644 (file)
@@ -56,7 +56,9 @@ OstreeRepo* ostree_repo_new (GFile *path);
 
 OstreeRepo* ostree_repo_new_default (void);
 
-gboolean      ostree_repo_check (OstreeRepo  *self, GError **error);
+gboolean      ostree_repo_open   (OstreeRepo     *self,
+                                  GCancellable   *cancellable,
+                                  GError        **error);
 
 gboolean      ostree_repo_create (OstreeRepo     *self,
                                   OstreeRepoMode  mode,
index f16edd31c10217331315767f5eeab9942ccfa6fd..882c41aa263761ad097f1bf2faf3f1acddf44e75 100644 (file)
@@ -93,7 +93,7 @@ ot_admin_builtin_upgrade (int argc, char **argv, GFile *sysroot, GCancellable *c
 
   repo_path = g_file_resolve_relative_path (sysroot, "ostree/repo");
   repo = ostree_repo_new (repo_path);
-  if (!ostree_repo_check (repo, error))
+  if (!ostree_repo_open (repo, cancellable, error))
     goto out;
 
   origin = ot_deployment_get_origin (merge_deployment);
index 8aca8817d7f3031851ed952ec3f2d25297444403..a3f39022210ad00937bd6f2edcb78e19c06c8988 100644 (file)
@@ -829,7 +829,7 @@ ot_admin_get_repo (GFile         *sysroot,
   gs_unref_object GFile *repo_path = g_file_resolve_relative_path (sysroot, "ostree/repo");
 
   ret_repo = ostree_repo_new (repo_path);
-  if (!ostree_repo_check (ret_repo, error))
+  if (!ostree_repo_open (ret_repo, cancellable, error))
     goto out;
     
   ret = TRUE;
index 240659456ca08925c9baf3f26cf9558c6581dfe8..090b9b5ba247e415cc3a6cf9ae66e156ddf82e70 100644 (file)
@@ -192,7 +192,7 @@ ostree_builtin_pull_local (int argc, char **argv, OstreeRepo *repo, GCancellable
   src_f = g_file_new_for_path (src_repo_path);
 
   data->src_repo = ostree_repo_new (src_f);
-  if (!ostree_repo_check (data->src_repo, error))
+  if (!ostree_repo_open (data->src_repo, cancellable, error))
     goto out;
 
   data->threadpool = ot_thread_pool_new_nproc (import_one_object_thread, data);
index 9e1b4fa2e8ba87a1ab672d43a72987a6fc73e6a1..1138f861093e7168a9f750655f48867c2dc5e9df 100644 (file)
@@ -224,7 +224,7 @@ ostree_run (int    argc,
     {
       GError *temp_error = NULL;
       repo = ostree_repo_new_default ();
-      if (!ostree_repo_check (repo, &temp_error))
+      if (!ostree_repo_open (repo, cancellable, &temp_error))
         {
           if (g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
             {
@@ -246,7 +246,7 @@ ostree_run (int    argc,
       repo = ostree_repo_new (repo_file);
       if (!(command->flags & OSTREE_BUILTIN_FLAG_NO_CHECK))
         {
-          if (!ostree_repo_check (repo, &error))
+          if (!ostree_repo_open (repo, cancellable, &error))
             goto out;
         }
     }